/*
 * @Description: 登记 - 格式转换相关接口
 * @Author: Rfan
 * @Date: 2022-11-23 11:27:41
 * @LastEditTime: 2022-11-23 18:35:23
 */

import request from '@/utils/request';
import { Key } from 'react';
import { IPageQuery } from '@/interfaces/global';

export interface IRegDiskMgtListParams {
  createTime?: string;
  detectionJobId?: number;
  detectionModel?: string;
  detectionProject?: string;
  diskNo?: number;
  errorCount?: number;
  id?: number;
  operator?: number;
  operatorName?: string;
  operatorTime?: string;
  recordFormat?: string;
  registrant?: string;
  registrationTime?: string;
  remark?: string;
  result?: string;
  totalCount?: number;
}

// 分页查询格式转换登记列表
export function fetchRegDiskMgtListByPage(data: IPageQuery<IRegDiskMgtListParams>) {
  return request({
    url: `/register-vector-detection/page`,
    method: 'post',
    data
  });
}

export interface IAddRegDiskMgtParams {
  detectionJobId: number;
  detectionModel: string;
  detectionProject: string;
  diskNo: number;
  errorCount: number;
  recordFormat: string;
  registrant: string;
  registrationTime: string;
  remark?: string;
  result: string;
  totalCount: number;
}

// 添加格式转换登记条目
export function addRegDiskMgt(data: IAddRegDiskMgtParams) {
  return request({
    url: `/register-vector-detection/`,
    method: 'post',
    data
  });
}

export interface IEditRegDiskMgtParams extends IAddRegDiskMgtParams {
  id: number;
}
// 编辑格式转换登记条目
export function editRegDiskMgt(data: IEditRegDiskMgtParams) {
  return request({
    url: `/register-vector-detection/`,
    method: 'put',
    data
  });
}

// 删除格式转换登记条目
export function deleteRegDiskMgtItem(id: Key) {
  return request({
    url: `/register-vector-detection/${id}`,
    method: 'delete'
  });
}
